package com.alibaba.csp.sentinel.dashboard.rule.nacos.gateway;

import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiDefinitionEntity;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher;
import com.alibaba.csp.sentinel.dashboard.rule.nacos.AbstractRuleNacosPublisher;
import com.alibaba.csp.sentinel.dashboard.rule.nacos.SentinelNacosConstants;
import com.alibaba.csp.sentinel.dashboard.rule.nacos.SentinelNacosConvert;
import com.alibaba.csp.sentinel.util.AssertUtil;
import com.alibaba.nacos.api.config.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author marcher
 */
@Component("gatewayApiRuleNacosPublisher")
public class GatewayApiRuleNacosPublisher extends AbstractRuleNacosPublisher<List<ApiDefinitionEntity>> {

    @Override
    public void publish(String app, List<ApiDefinitionEntity> rules) throws Exception {
        publishConfig(app, rules);
    }

    @Override
    protected String postfix() {
        return SentinelNacosConstants.GATEWAY_API_DATA_ID_POSTFIX;
    }
}